<?php

/**
 * apoio actions.
 *
 * @package    ibe
 * @subpackage apoio
 * @author     Creatix
 */
class apoioActions extends sfActionsCreatix
{
 	public function executePesquisarCPF(sfWebRequest $request)
 	{
 		$result = array();
 		
 		$dql = "nu_cpf = '". preg_replace('/[^0-9]/', '', $request->getParameter('id')) ."'";
 		$dadosResponsavel = Doctrine::getTable('DadosResponsavel')->findByDql($dql);
 		
 		if(count($dadosResponsavel))
 			$result = $dadosResponsavel;
 		
 		$dql = "nu_cpf = '". preg_replace('/[^0-9]/', '', $request->getParameter('id')) ."'";
 		$dadosDocente = Doctrine::getTable('Docente')->findByDql($dql);
 		
 		if(count($dadosDocente))
 			$result = $dadosDocente;
 		
 		$this->getResponse()->setHttpHeader('Content-type','application/json; charset=utf-8');
		return $this->renderText(json_encode($result));
 	}
}
